package me.magicall.db.sql.condition;

import me.magicall.db.sql.expression.Expression;

public class In extends NegativableCondition {

	public In() {
		super();
	}

	public In(final Expression<?> firstArg, final Expression<?> secondArg) {//TODO:这个Exception需要具体化
		super(firstArg, OneConditionOperator.IN, secondArg);
	}

//	@Override
//	public SqlBuilder appendToWithPlaceHoldable(final SqlBuilder sb) {
//		getFirstArg().appendTo(sb);
//		sb.append(getNot() ? " NOT IN(" : " IN(");
//		final Expression<?> value = getSecondArg();
//		if (value == null) {
//			sb.append(DbUtil.PLACE_HOLDER);
//		} else {
//			value.appendTo(sb);
//		}
//		return sb.append(")");
//	}

	@Override
	public StringBuilder appendTo(final StringBuilder sb) {
		getFirstArg().appendTo(sb);
		sb.append(getNot() ? " NOT IN(" : " IN(");
		getSecondArg().appendTo(sb);
		return sb.append(")");
	}
}
